# -*- coding:utf-8 -*-
import urllib2
import urllib
import json

def cmdb_http_api(data,cmdb_server):
    try:
        data_post = {'data': json.dumps(data)}
        data_post = urllib.urlencode(data_post)
        req = urllib2.Request(cmdb_server, data_post)
        urllib2.urlopen(req)
        flag = True
    except urllib2.URLError as error:
        flag = False
        print error
    return flag